home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_iisrvls.asp < prev    next >
Encoding:
Text File  |  1999-06-03  |  6.7 KB  |  259 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4.  
  5. <!-- Document that displays the tree-structured TOC-->
  6.  
  7. <% if Session("FONTSIZE") = "" then %>
  8.     <!--#include file="iito.inc"-->
  9. <% else %>
  10.  
  11. <% 
  12. '     Copyright (c) 1998 Microsoft Corporation
  13. '
  14. '    Module Name:    
  15. '        iisrvls.asp
  16. '    Abstract:
  17. '        Displays the tree view list stored by iihd.asp
  18. '    Author:
  19. '        Lara Dillingham (larad)
  20. '    Revision History:
  21. '        30-Oct-1998        taylorw        added support for multi-select
  22.  
  23. Const STR_SUPPORT_MULTI_SELECT = "hasDHTML"
  24. %>
  25.  
  26. <!--#include file="iisrvls.str"-->
  27. <!--#include file="iisetfnt.inc"-->
  28. <HTML>
  29. <BODY BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#000000" ALINK="#000000">
  30.  
  31.  
  32. <SCRIPT LANGUAGE="JavaScript">
  33.     var theList            = top.title.nodeList;
  34.     var gVars            = top.title.Global;
  35.     var gListInterface     = top.title.nodeListInterface
  36.     var listLength        = theList.length;
  37.     
  38.     document.write("<TABLE  WIDTH='" + gVars.tblWdith + "' BORDER=0><TR><TD>");
  39.  
  40.     for (i=0; i < listLength; i++) {
  41.         if (!theList[i].deleted){
  42.             theParent=theList[i].parent;
  43.             theLevel=theList[i].level;
  44.     
  45.             if (theParent==null) {
  46.                 writeSelected(theList[i].selected);    
  47.             }
  48.             else{
  49.                 curParent=theParent;
  50.                 isOpen=true;
  51.                 while(isOpen){
  52.                     if (theList[curParent].parent==null){
  53.                         isOpen=(theList[curParent].open);
  54.                         break;
  55.                     }
  56.                     if (!theList[curParent].open){
  57.                         isOpen=false;
  58.                         break;
  59.                     }
  60.                     curParent=theList[curParent].parent;
  61.                 }
  62.                 if (isOpen){    
  63.                     writeSelected(theList[i].selected);    
  64.                 }
  65.             }
  66.         }
  67.     }
  68.     document.write("</TD></TR></TABLE>");
  69.  
  70.     // BUGBUG - This will cause the browser window to activate on IE5.
  71.     // To workaround we can just pass in a query string parameter but this
  72.     // isn't show-stopped for B3 so we won't do it now.
  73.     self.location.href="iisrvls.asp#here";
  74.  
  75.     function writeSelected(isSelected){
  76.         writeStr = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD>";
  77.  
  78.         for (x=1; x < theLevel; x++) {
  79.  
  80.             gParent=getGrandParent(i,theLevel-x)
  81.             if (theList[gParent].lastChild){
  82.                 writeStr += "<IMG SRC='"+gVars.spaceImg+"' WIDTH=16>";
  83.             }
  84.             else{        
  85.                 writeStr += "<IMG SRC='"+gVars.lineImg+"' WIDTH=16>";
  86.             }
  87.         }
  88.  
  89.         writeStr += "</TD><TD>";
  90.  
  91.         if (((i+1) < listLength) && (theList[i+1].parent==i) && (!theList[i+1].deleted) || (!theList[i].isCached)) {
  92.             if (theList[i].open){
  93.                 writeStr += "<A HREF='javascript:expand("+i+")'><IMG SRC='";
  94.                 if (!theList[i].lastChild){
  95.                     writeStr += gVars.minusImg;    
  96.                 }
  97.                 else{
  98.                     writeStr += gVars.minusImgLast;    
  99.                 }
  100.                 writeStr += "' WIDTH=16 HEIGHT=18 Border=0 ALT='<%= L_COLLAPSE_TEXT %>'></A>";
  101.             }
  102.             else{
  103.                 writeStr += "<A HREF='javascript:expand("+i+")'><IMG SRC='";
  104.                 if (!theList[i].lastChild){
  105.                 writeStr += gVars.plusImg;
  106.                 }
  107.                 else{
  108.                     writeStr += gVars.plusImgLast;
  109.                 }
  110.                 writeStr += "' WIDTH=16 HEIGHT=18  Border=0 ALT='<%= L_EXPAND_TEXT %>'></A>";
  111.             }
  112.         }
  113.         else{
  114.             writeStr += "<IMG SRC='";
  115.             if (theList[i].lastChild){
  116.                 writeStr += gVars.emptyImgLast;    
  117.             }
  118.             else{
  119.                 writeStr += gVars.emptyImg;    
  120.             }
  121.             writeStr += "' WIDTH=16 HEIGHT=18 Border=0>";            
  122.         }
  123.  
  124.         writeStr += "</TD>";
  125.  
  126.  
  127.         if (isSelected){
  128.             if( gVars.selCount == 1 )
  129.             {
  130.                 writeStr += "<TD><A NAME='here'></A><A HREF='javascript:editItem("+i+")'";
  131.             }
  132.             else
  133.             {
  134.                 writeStr += "<TD><A NAME='here'></A><A HREF='javascript:selectItem("+i+")'";
  135.             }
  136.         <% if Session(STR_SUPPORT_MULTI_SELECT) then %>
  137.             writeStr += " onClick='handleClickEvent(" + i + ")'";
  138.         <% end if %>
  139.             writeStr += ">"
  140.             if (theList[i].icon !=""){
  141.  
  142.                 if (theList[i].isCached){
  143.                     writeStr += "<IMG BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif'><IMG BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  144.                 }
  145.                 else{
  146.                     writeStr += "<IMG BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif' ALT='<%= L_CACHE_TEXT %>'><IMG BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  147.                 }
  148.             }
  149.             writeStr += "</A></TD>";        
  150.             writeStr +=  "<TD BGCOLOR='Silver'>";
  151.             writeStr += "<%= sFont("","","",True) %>";
  152.             if( gVars.selCount == 1 )
  153.             {
  154.                 writeStr += "<A HREF='javascript:editItem("+i+")'";
  155.             }
  156.             else
  157.             {
  158.                 writeStr += "<A HREF='javascript:selectItem("+i+")'";
  159.             }
  160.         <% if Session(STR_SUPPORT_MULTI_SELECT) then %>
  161.             writeStr += " onClick='handleClickEvent(" + i + ")'";
  162.         <% end if %>
  163.             writeStr += ">"
  164.             writeStr += theList[i].title;
  165.             if (theList[i].vtype == "server"){writeStr += " " + gVars.displaystate[theList[i].state];}
  166.             writeStr += "</A>"
  167.             writeStr += "</TD>";
  168.         }
  169.         else{
  170.             writeStr += "<TD><A HREF='javascript:selectItem("+i+")'";
  171.         <% if Session(STR_SUPPORT_MULTI_SELECT) then %>
  172.             writeStr += " onClick='handleClickEvent(" + i + ")'";
  173.         <% end if %>
  174.             writeStr += ">"
  175.             if (theList[i].icon !=""){
  176.                 if (theList[i].isCached){
  177.                     writeStr += "<IMG BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif'><IMG BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  178.                 }
  179.                 else{
  180.                     writeStr += "<IMG BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif' ALT='<%= L_CACHE_TEXT %>'><IMG BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  181.                 }
  182.             }
  183.             writeStr += "</A></TD>";
  184.             
  185.             writeStr += "<TD>";
  186.             writeStr += "<%= sFont("","","",True) %>";
  187.             writeStr += "<A HREF='javascript:selectItem("+i+")'";
  188.         <% if Session(STR_SUPPORT_MULTI_SELECT) then %>
  189.             writeStr += " onClick='handleClickEvent(" + i + ")'";
  190.         <% end if %>
  191.             writeStr += ">"
  192.             writeStr += theList[i].title;
  193.             if (theList[i].vtype == "server"){writeStr += " " + gVars.displaystate[theList[i].state];}
  194.             writeStr += "</A></TD>";
  195.         }
  196.  
  197.  
  198.         writeStr += "</TR></TABLE>";
  199.         
  200.         document.write(writeStr);
  201.     }
  202.  
  203.     function getGrandParent(item,numLevels){
  204.         var theItem=item;
  205.         for (z=0; z < numLevels; z++) {
  206.             theItem=theList[theItem].parent;    
  207.         }
  208.         
  209.         return theItem;
  210.     }
  211.  
  212.     function expand(item)
  213.     {
  214.         gListInterface.selectItem(item);
  215.         if (theList[item].isCached)
  216.         {
  217.             theList[item].open=!(theList[item].open);
  218.             self.location.href="iisrvls.asp";            
  219.         }
  220.         else
  221.         {
  222.             theList[item].cache(item);
  223.         }
  224.     }
  225.  
  226.     function selectItem(item)
  227.     {
  228.     <% if Not Session(STR_SUPPORT_MULTI_SELECT) then %>
  229.         gListInterface.selectItem(item);
  230.     <% end if %>
  231.         self.location.href="iisrvls.asp";            
  232.     }
  233.     
  234. <% if Session(STR_SUPPORT_MULTI_SELECT) then %>
  235.     function handleClickEvent( item )
  236.     {
  237.         if( event.ctrlKey )
  238.         {
  239.             gListInterface.selectMulti(item);
  240.         }
  241.         else
  242.         {
  243.             gListInterface.selectItem(item);
  244.         }
  245.     }
  246. <% end if %>
  247.     
  248.     function editItem(item)
  249.     {
  250.         if( gVars.selCount == 1 )
  251.         {
  252.             theList[item].openLocation();
  253.         }
  254.     }
  255.     
  256. </SCRIPT>
  257. </BODY>
  258. </HTML>
  259. <% end if %>